package com.lxw.oa.controller.common;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.lxw.oa.controller.io.BaseTo;
import com.lxw.oa.entity.ChartsCfgBarData;
import com.lxw.oa.entity.ChartsCfgFunction;
import com.lxw.oa.entity.ChartsCfgPieData;
import com.lxw.oa.entity.ChartsCfgRadarData;
import com.lxw.oa.service.ChartsConfigService;
import com.lxw.oa.util.ChartsUtil;
import com.lxw.oa.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
    @Controller
    @RequestMapping(value = "/cfg")
    public class chartsConfigController {

        @Autowired
        private ChartsConfigService chartsConfigService;

        /*************** 图表获取 ***************/

        /**
         * 根据功能链接地址获取图表
         * @param request
         * @param func_link
         * @return ChartsConfigService
         */
        @RequestMapping(value = "/getChartsByUrl",method = RequestMethod.GET)
        @ResponseBody
        public BaseTo getChartsByUrl(HttpServletRequest request, Model model, String func_link){

            String func_id = "";
            String func_name = "";
            String func_type = "";
            int is_title = 0;
            int is_legend = 0;
            int is_toolbox = 0;
            int is_xychg = 0;
            int is_torus = 0;
            int is_stack = 0;
            String charts_option = "";
            List<Object> multi_optList = new ArrayList<Object>(); //多个图表的Option列表
            List<ChartsCfgFunction> funcList = chartsConfigService.getCfgFunctionByFuncLink(func_link);
            for(int i=0,j=funcList.size(); i<j; i++) {
                ChartsCfgFunction cfgFunc = funcList.get(i);
                func_id = cfgFunc.getFunc_id();
                func_name = cfgFunc.getFunc_name();
                func_type = cfgFunc.getFunc_type();
                String _is_tit = cfgFunc.getIs_title();
                String _is_leg = cfgFunc.getIs_legend();
                String _is_box = cfgFunc.getIs_toolbox();
                String _is_xychg = cfgFunc.getIs_xychg();
                String _is_torus = cfgFunc.getIs_torus();
                String _is_stack = cfgFunc.getIs_stack();
                if(!StringUtil.isEmpty(_is_tit)) { is_title = Integer.parseInt(_is_tit.split("\\.")[0]); }
                if(!StringUtil.isEmpty(_is_leg)) { is_legend = Integer.parseInt(_is_leg.split("\\.")[0]); }
                if(!StringUtil.isEmpty(_is_box)) { is_toolbox = Integer.parseInt(_is_box.split("\\.")[0]); }
                if(!StringUtil.isEmpty(_is_xychg)) { is_xychg = Integer.parseInt(_is_xychg.split("\\.")[0]); }
                if(!StringUtil.isEmpty(_is_torus)) { is_torus = Integer.parseInt(_is_torus.split("\\.")[0]); }
                if(!StringUtil.isEmpty(_is_stack)) { is_stack = Integer.parseInt(_is_stack.split("\\.")[0]); }

                if("101".equals(func_type)) {//一维柱状图

                    charts_option = getChartsBarOption(request, func_id, func_name,
                            is_title , is_legend , is_toolbox, is_xychg, is_stack);
                    multi_optList.add(charts_option);

                } else if("102".equals(func_type)) {//一维饼图

                    charts_option = getChartsPieOption(request, func_id, func_name,
                            is_title , is_legend , is_toolbox, is_torus);
                    multi_optList.add(charts_option);

                } else if("1".equals(func_type)) {//单行表格
                    //multi_optList.add(func_id);

                } else if("2".equals(func_type)) {//多行表格
                    //multi_optList.add(func_id);

                }
/*                else if("103".equals(func_type)) {//折线图

                    charts_option = getChartsLineOption(request, func_id, func_name,
                            is_title , is_legend , is_toolbox);
                    multi_optList.add(charts_option);

                }*/ else if("104".equals(func_type)) {//仪表盘

                } else if("105".equals(func_type)) {//雷达图

                    charts_option = getChartsRadarOption(request, func_id, func_name,
                            is_title , is_legend , is_toolbox);
                    multi_optList.add(charts_option);

                }
/*                else if("106".equals(func_type)) {//散点图

                    charts_option = getChartsScatterOption(request, func_id, func_name,
                            is_title , is_legend , is_toolbox);
                    multi_optList.add(charts_option);

                } else if("107".equals(func_type)) {//关系图

                }
                else if("108".equals(func_type)) {//字符云

                    charts_option = getChartsWordcloudOption(request, func_id, func_name,
                            is_title , is_legend , is_toolbox);
                    multi_optList.add(charts_option);

                } */
                else if("109".equals(func_type)) {//地图

                } else {

                }

            }
            return new BaseTo(multi_optList);
        }

        /**
         * 获取柱状图的数据列表
         * @param func_id
         */
        public String getChartsBarOption(HttpServletRequest request, String func_id, String func_name,
                                         int is_title, int is_legend, int is_toolbox, int is_xychg, int is_stack) {

            String tmp_data_id = "";
            String data_id = "";
            String charts_title = "";
            String charts_style_type = "";
            String charts_sql = "";
            String charts_link = "";
            String charts_x_name = "";
            String charts_x_field = "";
            String charts_y_name = "";
            String charts_y_field = "";
            String charts_option = "";
            String charts_color = "";
            String charts_width = "";
            List dList = null;
            List xList = null;
            List yList = null;
            List<Object> multi_tList = new ArrayList<Object>(); //多个图表的标题列表
            List<Object> multi_xList = new ArrayList<Object>(); //多个图表的X轴列表
            List<Object> multi_yList = new ArrayList<Object>(); //多个图表的数据列表
            List<Object> multi_cList = new ArrayList<Object>(); //多个图表的颜色列表
            List<Object> multi_wList = new ArrayList<Object>(); //多个图表的宽度列表
            List<ChartsCfgBarData> barList = chartsConfigService.getCfgBarDataByFuncId(func_id);
            if(!StringUtil.isEmpty(barList)) {
                for(int m=0,n=barList.size();m<n;m++) {
                    ChartsCfgBarData cfgBarData = barList.get(m);
                    data_id = cfgBarData.getData_id();
                    if(m == 0) { tmp_data_id = data_id; } //一个图表有多个数据时，默认取第一个数据的条件进行替换所有的SQL
                    charts_title = cfgBarData.getCharts_title();
                    charts_style_type = cfgBarData.getCharts_style_type();
                    charts_sql = cfgBarData.getCharts_sql();
                    charts_link = cfgBarData.getCharts_link();
                    charts_x_name = cfgBarData.getCharts_x_name();
                    charts_x_field = cfgBarData.getCharts_x_field();
                    charts_y_name = cfgBarData.getCharts_y_name();
                    charts_y_field = cfgBarData.getCharts_y_field();
                    charts_color = cfgBarData.getCharts_color();
                    charts_width = cfgBarData.getCharts_width();
                    dList = getChartsDataBySQL(request, tmp_data_id, charts_sql);
                    xList = getChartsX(dList, charts_x_field);
                    yList = getChartsY(dList, charts_y_field);
                    multi_xList = new ArrayList<Object>();
                    multi_tList.add(charts_title);
                    multi_xList.add(xList);
                    multi_yList.add(yList);
                    multi_cList.add(charts_color);
                    multi_wList.add(charts_width);
                }
            }
            charts_option = ChartsUtil.getBarOption(func_name, is_title , is_legend , is_toolbox, is_xychg, is_stack,
                    charts_x_name, charts_y_name, multi_tList, multi_xList, multi_yList,
                    multi_cList, multi_wList);

            return charts_option;
        }

        /**
         * 获取饼图的数据列表
         * @param func_id
         */
        public String getChartsPieOption(HttpServletRequest request, String func_id, String func_name,
                                         int is_title, int is_legend, int is_toolbox, int is_torus) {

            String tmp_data_id = "";
            String data_id = "";
            String charts_title = "";
            String charts_style_type = "";
            String charts_sql = "";
            String charts_link = "";
            String charts_x_name = "";
            String charts_x_field = "";
            String charts_y_name = "";
            String charts_y_field = "";
            String charts_option = "";
            String charts_color = "";
            List dList = null;
            List xList = null;
            List yList = null;
            List<Object> multi_tList = new ArrayList<Object>(); //多个图表的标题列表
            List<Object> multi_xList = new ArrayList<Object>(); //多个图表的X轴列表
            List<Object> multi_yList = new ArrayList<Object>(); //多个图表的数据列表
            List<Object> multi_cList = new ArrayList<Object>(); //多个图表的颜色列表
            List<ChartsCfgPieData> _dlist = chartsConfigService.getCfgPieDataByFuncId(func_id);
            if(!StringUtil.isEmpty(_dlist)) {
                for(int m=0,n=_dlist.size();m<n;m++) {
                    ChartsCfgPieData _cData = _dlist.get(m);
                    data_id = _cData.getData_id();
                    if(m == 0) { tmp_data_id = data_id; } //一个图表有多个数据时，默认取第一个数据的条件进行替换所有的SQL
                    charts_title = _cData.getCharts_title();
                    charts_style_type = _cData.getCharts_style_type();
                    charts_sql = _cData.getCharts_sql();
                    charts_link = _cData.getCharts_link();
                    charts_x_name = _cData.getCharts_x_name();
                    charts_x_field = _cData.getCharts_x_field();
                    charts_y_name = _cData.getCharts_y_name();
                    charts_y_field = _cData.getCharts_y_field();
                    charts_color = _cData.getCharts_color();
                    dList = getChartsDataBySQL(request, tmp_data_id, charts_sql);
                    xList = getChartsX(dList, charts_x_field);
                    yList = getChartsY(dList, charts_y_field);
                    //multi_xList = new ArrayList<Object>();
                    //multi_yList = new ArrayList<Object>();
                    multi_tList.add(charts_title);
                    multi_xList.add(xList);
                    multi_yList.add(yList);
                    multi_cList.add(charts_color);
                }
            }
            charts_option = ChartsUtil.getPieOption(func_name, is_title , is_legend , is_toolbox, is_torus,
                    charts_x_name, charts_y_name, multi_tList, multi_xList, multi_yList, multi_cList);

            return charts_option;
        }

//        /**
//         * 获取折线图的数据列表
//         * @param request
//         * @param func_id
//         * @param func_name
//         * @param is_title
//         * @param is_legend
//         * @param is_toolbox
//         * @return
//         */
//        public String getChartsLineOption(HttpServletRequest request, String func_id, String func_name,
//                                          int is_title, int is_legend, int is_toolbox) {
//
//            String tmp_data_id = "";
//            String data_id = "";
//            String charts_title = "";
//            String charts_style_type = "";
//            String charts_sql = "";
//            String charts_link = "";
//            String charts_x_name = "";
//            String charts_x_field = "";
//            String charts_y_name = "";
//            String charts_y_field = "";
//            String charts_option = "";
//            String charts_color = "";
//            List dList = null;
//            List xList = null;
//            List yList = null;
//            List<Object> multi_tList = new ArrayList<Object>(); //多个图表的标题列表
//            List<Object> multi_xList = new ArrayList<Object>(); //多个图表的X轴列表
//            List<Object> multi_yList = new ArrayList<Object>(); //多个图表的数据列表
//            List<Object> multi_cList = new ArrayList<Object>(); //多个图表的颜色列表
//            List<AnalysisCfgLineDataInfo> cfgList = analysisCfgLineDataService.getCfgDataByFuncId(func_id);
//            if(!StringUtil.isEmpty(cfgList)) {
//                for(int m=0,n=cfgList.size();m<n;m++) {
//                    AnalysisCfgLineDataInfo cfgData = cfgList.get(m);
//                    data_id = cfgData.getData_id();
//                    if(m == 0) { tmp_data_id = data_id; } //一个图表有多个数据时，默认取第一个数据的条件进行替换所有的SQL
//                    charts_title = cfgData.getCharts_title();
//                    charts_style_type = cfgData.getCharts_style_type();
//                    charts_sql = cfgData.getCharts_sql();
//                    charts_link = cfgData.getCharts_link();
//                    charts_x_name = cfgData.getCharts_x_name();
//                    charts_x_field = cfgData.getCharts_x_field();
//                    charts_y_name = cfgData.getCharts_y_name();
//                    charts_y_field = cfgData.getCharts_y_field();
//                    charts_color = cfgData.getCharts_color();
//                    dList = getChartsDataBySQL(request, tmp_data_id, charts_sql);
//                    xList = getChartsX(dList, charts_x_field);
//                    yList = getChartsY(dList, charts_y_field);
//                    multi_xList = new ArrayList<Object>();
//                    multi_tList.add(charts_title);
//                    multi_xList.add(xList);
//                    multi_yList.add(yList);
//                    multi_cList.add(charts_color);
//                }
//            }
//            charts_option = ChartsUtil.getLineOption(func_name, is_title , is_legend , is_toolbox,
//                    charts_x_name, charts_y_name, multi_tList, multi_xList, multi_yList, multi_cList);
//
//            return charts_option;
//        }

        /**
         * 获取雷达图的数据列表
         * @param request
         * @param func_id
         * @param func_name
         * @param is_title
         * @param is_legend
         * @param is_toolbox
         * @return
         */
        public String getChartsRadarOption(HttpServletRequest request, String func_id, String func_name,
                                           int is_title, int is_legend, int is_toolbox) {

            String tmp_data_id = "";
            String data_id = "";
            String charts_title = "";
            String charts_style_type = "";
            String charts_sql = "";
            String charts_link = "";
            String charts_x_name = "";
            String charts_x_field = "";
            String charts_y_name = "";
            String charts_y_field = "";
            String charts_option = "";
            String charts_color = "";
            List dList = null;
            List xList = null;
            List yList = null;
            List<Object> multi_tList = new ArrayList<Object>(); //多个图表的标题列表
            List<Object> multi_xList = new ArrayList<Object>(); //多个图表的X轴列表
            List<Object> multi_yList = new ArrayList<Object>(); //多个图表的数据列表
            List<Object> multi_cList = new ArrayList<Object>(); //多个图表的颜色列表
            List<ChartsCfgRadarData> cfgList = chartsConfigService.getCfgRadarDataByFuncId(func_id);
            if(!StringUtil.isEmpty(cfgList)) {
                for(int m=0,n=cfgList.size();m<n;m++) {
                    ChartsCfgRadarData cfgData = cfgList.get(m);
                    data_id = cfgData.getData_id();
                    if(m == 0) { tmp_data_id = data_id; } //一个图表有多个数据时，默认取第一个数据的条件进行替换所有的SQL
                    charts_title = cfgData.getCharts_title();
                    charts_style_type = cfgData.getCharts_style_type();
                    charts_sql = cfgData.getCharts_sql();
                    charts_link = cfgData.getCharts_link();
                    charts_x_name = cfgData.getCharts_x_name();
                    charts_x_field = cfgData.getCharts_x_field();
                    charts_y_name = cfgData.getCharts_y_name();
                    charts_y_field = cfgData.getCharts_y_field();
                    charts_color = cfgData.getCharts_color();
                    dList = getChartsDataBySQL(request, tmp_data_id, charts_sql);
                    xList = getChartsX(dList, charts_x_field);
                    yList = getChartsY(dList, charts_y_field);
                    multi_xList = new ArrayList<Object>();
                    multi_tList.add(charts_title);
                    multi_xList.add(xList);
                    multi_yList.add(yList);
                    multi_cList.add(charts_color);
                }
            }
            charts_option = ChartsUtil.getRadarOption(func_name, is_title , is_legend , is_toolbox,
                    charts_x_name, charts_y_name, multi_tList, multi_xList, multi_yList, multi_cList);

            return charts_option;
        }

  /*      *//**
         * 获取散点图的数据列表
         * @param request
         * @param func_id
         * @param func_name
         * @param is_title
         * @param is_legend
         * @param is_toolbox
         * @return
         *//*
        public String getChartsScatterOption(HttpServletRequest request, String func_id, String func_name,
                                             int is_title, int is_legend, int is_toolbox) {

            String tmp_data_id = "";
            String data_id = "";
            String charts_title = "";
            String charts_style_type = "";
            String charts_sql = "";
            String charts_link = "";
            String charts_x_name = "";
            String charts_x_field = "";
            String charts_x_measure = "";
            String charts_y_name = "";
            String charts_y_field = "";
            String charts_y_measure = "";
            String charts_option = "";
            String charts_color = "";
            List dList = null;
            List xList = null;
            List yList = null;
            List<Object> multi_tList = new ArrayList<Object>(); //多个图表的标题列表
            List<Object> multi_xList = new ArrayList<Object>(); //多个图表的X轴列表
            List<Object> multi_yList = new ArrayList<Object>(); //多个图表的数据列表
            List<Object> multi_xyList = new ArrayList<Object>(); //多个图表的数据列表
            List<Object> multi_cList = new ArrayList<Object>(); //多个图表的颜色列表
            List<AnalysisCfgScatterDataInfo> cfgList = analysisCfgScatterDataService.getCfgDataByFuncId(func_id);
            if(!StringUtil.isEmpty(cfgList)) {
                for(int m=0,n=cfgList.size();m<n;m++) {
                    AnalysisCfgScatterDataInfo cfgData = cfgList.get(m);
                    data_id = cfgData.getData_id();
                    if(m == 0) { tmp_data_id = data_id; } //一个图表有多个数据时，默认取第一个数据的条件进行替换所有的SQL
                    charts_title = cfgData.getCharts_title();
                    charts_style_type = cfgData.getCharts_style_type();
                    charts_sql = cfgData.getCharts_sql();
                    charts_link = cfgData.getCharts_link();
                    charts_x_name = cfgData.getCharts_x_name();
                    charts_x_field = cfgData.getCharts_x_field();
                    charts_x_measure = cfgData.getCharts_x_measure();
                    charts_y_name = cfgData.getCharts_y_name();
                    charts_y_field = cfgData.getCharts_y_field();
                    charts_y_measure = cfgData.getCharts_y_measure();
                    charts_color = cfgData.getCharts_color();
                    dList = getChartsDataBySQL(request, tmp_data_id, charts_sql);
                    xList = getChartsX(dList, charts_x_field);
                    yList = getChartsY(dList, charts_y_field);
                    multi_xList = new ArrayList<Object>();
                    multi_tList.add(charts_title);
                    multi_xList.add(xList);
                    multi_yList.add(yList);
                    multi_xyList.add(dList);
                    multi_cList.add(charts_color);
                }
            }
            charts_option = ChartsUtil.getScatterOption(func_name, is_title , is_legend , is_toolbox,
                    charts_x_name, charts_y_name, charts_x_field, charts_y_field, charts_x_measure, charts_y_measure,
                    multi_tList, multi_xList, multi_yList, multi_xyList, multi_cList);

            return charts_option;
        }*/

  /*      *//**
         * 获取字符云的数据列表
         * @param request
         * @param func_id
         * @param func_name
         * @param is_title
         * @param is_legend
         * @param is_toolbox
         * @return
         *//*
        public String getChartsWordcloudOption(HttpServletRequest request, String func_id, String func_name,
                                               int is_title, int is_legend, int is_toolbox) {

            String tmp_data_id = "";
            String data_id = "";
            String charts_title = "";
            String charts_style_type = "";
            String charts_sql = "";
            String charts_link = "";
            String charts_x_name = "";
            String charts_x_field = "";
            String charts_y_name = "";
            String charts_y_field = "";
            String charts_option = "";
            String charts_color = "";
            List dList = null;
            List xList = null;
            List yList = null;
            List<Object> multi_tList = new ArrayList<Object>(); //多个图表的标题列表
            List<Object> multi_xList = new ArrayList<Object>(); //多个图表的X轴列表
            List<Object> multi_yList = new ArrayList<Object>(); //多个图表的数据列表
            List<Object> multi_cList = new ArrayList<Object>(); //多个图表的颜色列表
            List<AnalysisCfgWordcloudDataInfo> cfgList = analysisCfgWordcloudDataService.getCfgDataByFuncId(func_id);
            if(!StringUtil.isEmpty(cfgList)) {
                for(int m=0,n=cfgList.size();m<n;m++) {
                    AnalysisCfgWordcloudDataInfo cfgData = cfgList.get(m);
                    data_id = cfgData.getData_id();
                    if(m == 0) { tmp_data_id = data_id; } //一个图表有多个数据时，默认取第一个数据的条件进行替换所有的SQL
                    charts_title = cfgData.getCharts_title();
                    charts_style_type = cfgData.getCharts_style_type();
                    charts_sql = cfgData.getCharts_sql();
                    charts_link = cfgData.getCharts_link();
                    charts_x_name = cfgData.getCharts_x_name();
                    charts_x_field = cfgData.getCharts_x_field();
                    charts_y_name = cfgData.getCharts_y_name();
                    charts_y_field = cfgData.getCharts_y_field();
                    charts_color = cfgData.getCharts_color();
                    dList = getChartsDataBySQL(request, tmp_data_id, charts_sql);
                    xList = getChartsX(dList, charts_x_field);
                    yList = getChartsY(dList, charts_y_field);
                    multi_xList = new ArrayList<Object>();
                    multi_tList.add(charts_title);
                    multi_xList.add(xList);
                    multi_yList.add(yList);
                    multi_cList.add(charts_color);
                }
            }
            charts_option = ChartsUtil.getWordcloudOption(func_name, is_title , is_legend , is_toolbox,
                    charts_x_name, charts_y_name, multi_tList, multi_xList, multi_yList, multi_cList);

            return charts_option;
        }
*/


        /**
         * 获取图表动态显示数据
         * @return
         */
        public List getChartsDataBySQL(HttpServletRequest request, String data_id,String charts_sql) {
            return chartsConfigService.getChartsDataBySQL(request, data_id, charts_sql);
        }

        /**
         * 获取图表动态X轴数据
         * @param dList
         * @param x_field
         * @return
         */
        public List<String> getChartsX(List dList, String x_field) {

            List<String> xList = new ArrayList<String>();
            if(!StringUtil.isEmpty(dList)) {
                for(int i = 0; i < dList.size(); i++) {
                    Map m = (Map) dList.get(i);
                    xList.add(String.valueOf(m.get(x_field)));
                }
            }

            return xList;
        }

        /**
         * 获取图表动态Y轴数据
         * @param dList
         * @param y_field
         * @return
         */
        public List<String> getChartsY(List dList, String y_field) {

            List<String> yList = new ArrayList<String>();
            if(!StringUtil.isEmpty(dList)) {
                for(int i = 0; i < dList.size(); i++) {
                    Map m = (Map) dList.get(i);
                    yList.add(String.valueOf(m.get(y_field)));
                }
            }

            return yList;
        }


/*

        */
/**
         * 获取单行表格或多行表格的数据列表
         * @param request
         * @param bootstrapTable
         * @param bindingResult
         * @return
         *//*

        @RequestMapping(value = "/getOneTableByUrl",method = RequestMethod.GET)
        @ResponseBody
        public Map<String, Object> getOneTableByUrl(HttpServletRequest request,
                                                    BootstrapTable bootstrapTable, BindingResult bindingResult,
                                                    Model model, String func_link) {

            List dList = null;
            List cList = null;
            int recCnt = 0;
            List<ChartsCfgFunction> funcList = chartsConfigService.getCfgFunctionByFuncLink(func_link);
            ChartsCfgFunction cfgFunc = funcList.get(0);
            String func_id = cfgFunc.getFunc_id();
            String func_name = cfgFunc.getFunc_name();
            String func_type = cfgFunc.getFunc_type();
            List<AnalysisCfgTableDataInfo> dataList = analysisCfgTableDataService.getCfgDataByFuncId(func_id);
            AnalysisCfgTableDataInfo _cfgData = dataList.get(0);
            String data_id = _cfgData.getData_id();
            String table_title = _cfgData.getTable_title();
            String table_style_type = _cfgData.getTable_style_type();
            String table_sql = _cfgData.getTable_sql();
            String pageNo = "1";
            String pageSize = "10";
            String orderSort = "";
            String orderType = "";
            //主动设置pageSize大小且没有翻页（显示全部）
            String setPageSize = request.getParameter("set_pageSize");
            if(!StringUtil.isEmpty(setPageSize)){
                pageSize=setPageSize;
            }
            if(!StringUtil.isEmpty(bootstrapTable)) {
                if(!StringUtil.isEmpty(bootstrapTable.getPageNo())) {
                    pageNo = bootstrapTable.getPageNo().toString();
                }
                if(!StringUtil.isEmpty(bootstrapTable.getPageSize())) {
                    pageSize = bootstrapTable.getPageSize().toString();
                }
                orderSort = bootstrapTable.getSortOrder().getSort();
                orderType = bootstrapTable.getSortOrder().getOrder();
            }
            if(!StringUtil.isEmpty(orderSort)) {
                table_sql = "select * from ("+ table_sql +") qq order by "+ orderSort + " " + orderType;
            }
            int pn = Integer.parseInt(pageNo);
            int ps = Integer.parseInt(pageSize);
            dList = getChartsDataBySQL(request, data_id, table_sql, pn, ps);
            cList = analysisCfgTableColumnService.getColumnByDataId2(data_id);
            recCnt = chartsConfigService.getOraSqlCount(request, data_id, table_sql);
            Page<Map<String,Object>> page = new Page<>(pn, ps);
            page.setList(dList);
            page.setRecordCnt(Long.parseLong(recCnt+""));
            Map<String, Object> map = new HashMap<>();
            map.put("rows", page.getList());
            map.put("total", page.getRecordCnt());
            return map;
        }


*/

}
